package top.lgd.enums;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * 账户操作类型
 */
@Getter
public enum AccountOpTypeEnum {

    transIn("transIn", "转入"),
    transOut("transOut", "转出"),
    lendTo("lendTo", "借出"),
    lendBack("lendBack", "偿还"),
    consume("consume", "消费"),
    refund("refund", "还款"),
    check("check", "对账"),
    loanIn("loanIn", "贷入"),
    loanBack("loanBack", "还款"),
    interest("interest", "利息"),
    borrowIn("borrowIn", "借入"),
    borrowBack("borrowBack", "还款"),
    salary("salary", "工资"),
    ;

    private String type, desc;

    AccountOpTypeEnum(String type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    private final static Map<String, String> typeMap = new HashMap<>();

    static {
        for (AccountOpTypeEnum accountTypeEnum : AccountOpTypeEnum.values()) {
            typeMap.put(accountTypeEnum.getType(), accountTypeEnum.getDesc());
        }
    }

    public static String getDesc(String type) {
        return typeMap.get(type);
    }
}